﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true"
    CodeBehind="GravesCompensation.aspx.cs" Inherits="Giaiphongmatbang.GravesCompensation" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="Style/duan.css" rel="stylesheet" type="text/css" />
    <link href="Style/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function expand(id) {
            $('#<%=hdf.ClientID %>').val(id);
            $('#<%=btnExpand.ClientID %>').click();
        }

        function collapse(id) {
            $('#<%=hdf.ClientID %>').val(id);
            $('#<%=btnCollapse.ClientID %>').click();
        }

        function deletegrave(id) {
            var answer = confirm("Xóa loại mồ mả này khỏi danh sách hỗ trợ đền bù?");
            if (answer) {
                $('#<%=hdf.ClientID %>').val(id);
                $('#<%=btnDelete.ClientID %>').click();
            }
        }

        function showdialog() {
            $('.dialogForm').dialog({
                modal: true,
                autoOpen: false,
                width: 550,
                close: function () {
                    allFields.val("").removeClass("ui-state-error");
                }
            });
            $(".dialogForm").parent().appendTo($("form:first"))
            $('.dialogForm').dialog('open');
            return false;
        }

        $(document).ready(function () {
            $('.dialogForm').dialog({
                modal: true,
                autoOpen: false,
                width: 550,
                close: function () {
                    allFields.val("").removeClass("ui-state-error");
                }
            });
            $("#btnCancel").click(function () {
                $('.dialogForm').dialog('close');
            });
        });

        function addgrave(id) {
            $('#<%=txtGraveName.ClientID%>').val('');
            $('#<%=txtUnit.ClientID%>').val('');
            $('#<%=hdfmodenew.ClientID %>').val('true');
            $('#<%=txtDescriptions.ClientID%>').val('');
            $('#<%=txtUnitPrice.ClientID%>').val('');
            $('#<%=ddlGraveParent.ClientID%>').val(id);

            $(".dialogForm").parent().appendTo($("form:first"))
            $('.dialogForm').dialog('open');
            return false;
        }

        function editgrave(id, name, unit, price, parent, description) {
            $('#<%=hdf.ClientID %>').val(id);
            $('#<%=txtGraveName.ClientID %>').val(name);
            $('#<%=txtUnit.ClientID %>').val(unit);
            $('#<%=txtUnitPrice.ClientID %>').val(price);
            $('#<%=txtDescriptions.ClientID %>').val(description);
            $('#<%=ddlGraveParent.ClientID %>').val(parent);
            $('#<%=hdfmodenew.ClientID %>').val('false');

            $(".dialogForm").parent().appendTo($("form:first"))
            $('.dialogForm').dialog('open');
            return false;
        }

        function keypress(e) {
            var keypressed = null;
            if (window.event) {
                keypressed = window.event.keyCode;
            }
            else {
                keypressed = e.which;
            }

            if (keypressed < 48 || keypressed > 57) {
                if (keypressed == 8 || keypressed == 127 || keypressed == null || keypressed == 0 || keypressed == 9 || keypressed == 13) {
                    return;
                }
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="box-title">
        Bảng giá đền bù hỗ trợ di chuyển mồ mả
        <div class="nr" style="margin-top: 3px">
            <asp:ImageButton ID="ibtnAdd" runat="server" ImageUrl="~/Images/add-button.jpg" OnClientClick="return addgrave()" ToolTip="Thêm mới loại mồ mả" />
        </div>
    </div>
    <div>
        <asp:Literal ID="ltr" runat="server" EnableViewState="true" />
    </div>
    <div style="display: none">
        <asp:Button ID="btnDelete" runat="server" OnClick="btnDelete_Click" />
        <asp:Button ID="btnExpand" runat="server" OnClick="btnExpand_Click" />
        <asp:Button ID="btnCollapse" runat="server" OnClick="btnCollapse_Click" />
        <asp:HiddenField ID="hdf" runat="server" Value="" />
        <asp:HiddenField ID="hdfmodenew" runat="server" />
    </div>
    <div class="dialogForm" title="Cập nhật bảng giá đền bù hỗ trợ di chuyển mồ mả" style="display: none">
        <table cellpadding="5" cellspacing="5">
            <tr>
                <td>
                    Loại mồ mả
                </td>
                <td style="width: 400px;">
                    <asp:TextBox ID="txtGraveName" runat="server" Style="width: 100%" AutoComplete="Off"
                        CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    Chọn loại cha
                </td>
                <td>
                    <asp:DropDownList ID="ddlGraveParent" runat="server" Width="100%" CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    Đơn vị tính
                </td>
                <td>
                    <asp:TextBox ID="txtUnit" runat="server" Style="width: 100%" AutoComplete="Off" CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    Giá
                </td>
                <td>
                    <asp:TextBox ID="txtUnitPrice" runat="server" Style="width: 100%" AutoComplete="Off"
                        onkeypress="return keypress(event);" CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    Mô tả
                </td>
                <td>
                    <asp:TextBox ID="txtDescriptions" runat="server" Style="width: 100%" AutoComplete="Off"
                        CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnAddGrave" OnClientClick="return confirm('Xác nhận hành động?');"
                        CssClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
                        runat="server" Text="&nbsp;OK&nbsp;" OnClick="btnAddGrave_Click" />
                    <input type="button" id="btnCancel" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" value="Cancel" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
